package com.cskaoyan.mall.service;


import com.cskaoyan.mall.dao.OrdersDao;
import com.cskaoyan.mall.dao.OrdersDaoImpl;
import com.cskaoyan.mall.model.bo.PageOrdersBO;
import com.cskaoyan.mall.model.bo.UpdateOrderBO;
import com.cskaoyan.mall.model.vo.GetOrderVO;
import com.cskaoyan.mall.model.vo.PageOrdersVO;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OrdersServiceImpl implements OrdersService{
    private OrdersDao ordersDao = new OrdersDaoImpl();

    @Override
    public Map<String, Object> ordersByPage(PageOrdersBO pageOrdersBO) {
        //分页查询
        Integer count = ordersDao.getTotalCount(pageOrdersBO);
        List<PageOrdersVO> pageOrdersVOList = ordersDao.getOrderByPage(pageOrdersBO);
        Map map = new HashMap();
        map.put("total",count);
        map.put("orders",pageOrdersVOList);
        return map;
    }

    @Override
    public GetOrderVO order(String id) {
        return ordersDao.order(id);
    }

    @Override
    public int changeOrder(UpdateOrderBO updateOrderBO) {
        return ordersDao.changeOrder(updateOrderBO);
    }

    @Override
    public int deleteOrder(String id) {
        return ordersDao.deleteOrder(id);
    }
}
